package com.learning.enums;

/**
 * @author adolphw
 *
 * enum相当于数据库的一张表，离面有字段，key  值 值 值
 */

public enum CountryEnum {
    ONE(1, "齐"),
    TWO(2, "楚"),
    THREE(3, "燕"),
    FOUR(4, "赵"),
    FIVE(5, "魏"),
    SIX(6, "韩");

    private Integer retCode;

    private String retMessage;

    CountryEnum(int retCode, String retMessage) {

        this.retCode = retCode;
        this.retMessage = retMessage;
    }

    public Integer getRetCode() {
        return retCode;
    }

    public void setRetCode(Integer retCode) {
        this.retCode = retCode;
    }

    public String getRetMessage() {
        return retMessage;
    }

    public void setRetMessage(String retMessage) {
        this.retMessage = retMessage;
    }

    public static CountryEnum forEach_CountryEnum(int index) {

        CountryEnum[] countryEnums = CountryEnum.values();

        for (CountryEnum country : countryEnums) {

            if (country.retCode.equals(index)) {
                return country;
            }
        }

        return null;
    }

}
